#ifndef BMPCAPTOR_H
#define BMPCAPTOR_H

#include <string>
#include <iostream>
#include "stdafx.h"
#include "windows.h"
#include "LScreenCap.h"


using namespace std;

#import "VCamCOM.tlb" no_namespace, raw_interfaces_only exclude("UINT_PTR")

const CLSID CLSID_VCamSDK = {0x61E348C4,0xCEA8,0x48B6,{0xA7,0xAE,0x87,0xB6,0xD0,0x45,0x90,0xAE}};
const IID	IID_IVCamSDK = {0x7DA47CCB,0x2362,0x48AA,{0x98,0x96,0x52,0x0C,0xBE,0x44,0xEF,0xF7}};


class BmpCaptor {
public:
    //BmpCaptor(int imageWidth, int imageHeight, int bitsPerPixel);
	BmpCaptor();
	//BmpCaptor(int width, int height, int bitsPerPixel, unsigned char* imageData);
	//BmpCaptor(string filePath);
	~BmpCaptor();

	unsigned char* getImageData();
	int getImageDataSize();
	int getBitsPerPixel();
	int getImageWidth();
	int getImageHeight();
	int getRealWidth();
	void setImageSize(int width,int height);
	void setToScale(bool flag);

	void setImage(int width, int height, int bitsPerPixel, unsigned char* data);
	void outputImage();
	void captureImage();
	unsigned char biInterpolation(double a, double b, int u, int v, unsigned char* imageData, int rgbType,int width);
	UINT startPerCap(int fps);
	void stopPerCap();

protected:
    bool readBmp(char* bmpName);

private:
    IVCamSDK* m_pVCam;    
    LScreenCap* m_pLSCap;

	unsigned char* m_pImageData;
	int m_iImageWidth;
	int m_iImageHeight;
	int m_iBitsPerPixel;
	int m_iImageDataSize;
	UINT m_timerId;
	bool toScale;
};

#endif